#include "dialog.h"
#include "ui_dialog.h"

Dialog::Dialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::Dialog)
{
    ui->setupUi(this);
}

Dialog::~Dialog()
{
    delete ui;
}


//窗口变化事件
void Dialog::resizeEvent(QResizeEvent *)
{
    updateFun();
}


//窗口移动事件
void Dialog::moveEvent(QMoveEvent* )
{
    updateFun();
}


void Dialog::updateFun()
{
    int x = geometry().x(), y = geometry().y(), height1 = geometry().height(), width1 = geometry().width();
    QString str = QString().number(x) + "," + QString().number(y) + "," +
                  QString().number(height1) + "," + QString().number(width1);
    ui->label_6->setText(str);


    ui->label_7->setText(QString().setNum(width()));
    ui->label_8->setText(QString().setNum(height()));

    QString strrect;
    QString strrect1,strrect2,strrect3,strrect4;
    strrect=strrect1.setNum(rect().x())+","+strrect2.setNum(rect().y())+","+  //rect的x(), y()表示自己窗口的左上角
            strrect3.setNum(height())+","+strrect4.setNum(width());
    ui->label_9->setText(strrect);


    QString str1 = QString().number(size().height()) + "," + QString().number(size().width());
    ui->label_10->setText(str1);
}



